<?php
if(isset($form['#distributor_id']) && !empty($form['#distributor_id'])){
    echo get_template_header_info($form['#distributor_id'],'distributor');
}
?>
<div class="hp-tab-newprd">
    <ul class="j-sw-nav">
    <?php if(!$form['#distributor_id']){?>
        <li class="newprd-s1 tab-li on"><a href="<?php echo base_path();?>sales/monthly_report/list">查看</a></li>
        <?php if(user_access('add monthly_report')){?>
        <li class="newprd-s2 tab-li"><a href="<?php echo base_path();?>sales/monthly_report/add">添加</a></li>
        <?php } if(user_access('view monthly_report stats')){ ?>
        <li class="newprd-s3 tab-li"><a href="<?php echo base_path();?>sales/monthly_report/stats">统计</a></li>
        <?php }?>
    <?php }else{?>
        <?php echo get_tab($form['#distributor_id'],'monthly_report','distributor')?>
    <?php }?>
    </ul>
    <div class="newprd-s1">
        <div class="table-div">
            <?php if(isset($form['#distributor_id'])&& !empty($form['#distributor_id'])){?>
                <ul class="table-ul-li">
                    <li><a href="<?php echo base_path(); ?>sales/monthly_report/list?distributor_id=<?php echo $form['#distributor_id']?>" class="selected">列表</a></li>
                    <?php if(user_access('add monthly_report')){ ?>
                    <li>|</li>
                    <li><a href="<?php echo base_path(); ?>sales/monthly_report/add?distributor_id=<?php echo $form['#distributor_id']?>">添加</a></li>
                    <?php }?>
                </ul>
            <?php }?>
            <div class="search-div">
                <?php if(!$form['#distributor_id']){?>
                    <div class="small-select big-input"><div class="search-label">经销商:</div><?php print render($form['address_distributor']); ?></div>
                <?php }?>
                <div class="small-select small-input" style="clear:both"><div class="search-label">请选年份:</div><?php print render($form['year']); ?></div>
                <div class="small-select small-input"><div class="search-label">请选月份:</div><?php print render($form['month']); ?></div>
                <div class="small-select small-input">
                    <div class="search-label">请选字段:</div><?php print render($form['field']); ?>
                </div>
                <div class="small-select small-input">
                    <div style="float: left; width: 200px"><div class="search-label">范围:</div><?php print render($form['min_number']); ?></div>
                    <?php print render($form['max_number']); ?>
                </div>
                <div class="small-select small-input"><div class="search-label">提交人:</div><?php print render($form['employee_salesman']); ?></div>
                <?php global $user;
                if(get_user_role_name($user->uid) != 'administrator'){?>
                    <div class="small-select small-input"><div class="search-label">销售员:</div><?php print render($form['employee_list']); ?></div>
                <?php }?>
                <div class="search-submit"><?php print render($form['submit']); ?></div>
            </div>
            <img class="res-search" src='<?php echo base_path();?>sites/all/themes/tweme/images/images/res.png'>
            <div class="table-div">
                <?php print render($form['table']); ?>
            </div>
         </div>
    </div>
 </div>

<?php print drupal_render_children($form); ?>